function Get-NewAzureServerName {
    Param (
        [Parameter(Mandatory = $false)][String[]]$Blocklist,
        [Parameter(Mandatory = $false)][string]$ServerName,
        [Parameter(Mandatory = $false)][bool]$ConfirmAll = $false
    )

    # Allow user to use existing value or to update it.
    if ((Confirm-SingleValue -Description 'Azure SQL Server name' -Value $ServerName -ConfirmAll $ConfirmAll) -eq $true) { return $ServerName }

    # Get regex from config file.
    $regex = (Read-Config).Regex.AzureSQLServer # Length 1-63, Lowercase letters, numbers, and hyphens. Can't start or end with hyphen.
    
    # Ask user for a new name.
    Write-Host # Newline.
    Write-Host 'Please provide a name for the new Azure SQL Server resource. It must consist of lowercase letters, numbers or hyphens. Cannot start or end with a hyphen. Is 1-63 characters.'
    do {
        $newName = Read-Host -Prompt "Server name"
        if ($newName -iin $Blocklist) {
            $newName = $null
            Write-Warning 'Invalid name! The name you gave is already in use.'
        } elseif ($newName -cnotmatch $regex) {
            # Reset name if it doesn't match the regex.
            $newName = $null
            Write-Warning 'Invalid name!'
        }
    } while (!$newName)
    return $($newName -replace '\\+', '\\') # Make sure the server has two backslashes if there are any.
    # TODO: Verify that we need to have two backslashes.
}